#include<vector>
class Solution {
public:
    int findPoisonedDuration(std::vector<int>& timeSeries, int duration) {
        int count = 0;
        for (int i = 0; i < timeSeries.size() - 1; i++)
        {
            int timeing = timeSeries[i] + duration;
            if (timeing > timeSeries[i + 1])
            {
                count += timeSeries[i + 1] - timeSeries[i];
            }
            else
                count += duration;
        }

        return count + duration;
    }
};